<script type="text/javascript">
{% block data %}
var delay = Math.sqrt(19*5*(12+7)*(35/7)*2*2);
var curtest = 1;
{% endblock %}
var thisres = "{! resource_url(resource='static/practiceNNN.png') !}".replace("NNN", curtest+"");
</script>
<p>
Guess His Weight in Pounds (Practice)
<p>
<input type="text" id="guess" size="20" />
<input type="button" onclick="reveal(delay);return false;" value="Guess" />
{% block next %}
{! form_button('Next Picture', resource='practice2.htm') !}
{% endblock %}
<p>
<img id="theimg"/>
<script type="text/javascript">
document.getElementById("theimg").setAttribute("src",thisres);
function reveal(actual){
        try {
	        var guess = document.getElementById('guess').value;
                guess = parseInt(guess, 10);
                if ( ! ( guess > 0 ) ) {
                        result = "Please enter a valid number";
                } else if ( guess == actual ) {
        	        result = "Nice work - you are right!";
                } else if ( guess < actual ) {
		        result = "This person's actual weight is "+actual+" pounds. You guess of "+guess+" pounds is too low.";
                } else {
		        result = "This person's actual weight is "+actual+" pounds. You guess of "+guess+" pounds is too high.";
	        }
        } catch(err) {
                // IE HACK :)
	        result = "This person's actual weight is "+actual+" pounds.";
        } 
	alert(result);
}
</script>
